package com.yvan.leto.server.controller;

import com.yvan.YvanUtil;
import com.yvan.leto.server.service.EnvService;
import com.yvan.platform.ResultModel;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by luoyifan on 2018/6/17.
 */
@RestController
public class EnvController {

    @Autowired
    private EnvService envService;

    @GetMapping("/envs.htm")
    public ModelAndView projects() {
        ResultModel model = new ResultModel();
        val envs = envService.selectAll();
        model.put("envs_json", YvanUtil.toJsonPretty(envs));
        return new ModelAndView("/envs.ftl", model);
    }
}
